package com.endava.nio_io;

import java.nio.ByteBuffer;

public class Nio_Buffers_WithWrapper {
	public static void main(String[] args) {
		byte[] message = { 'H', 'o', 'w', 'd', 'y', '!' };

		ByteBuffer buffer = ByteBuffer.wrap(message);

		// buffer.flip(); must NOT do a flip (since we didn't do a 'put')

		int limit = buffer.limit();// how many chars in buffer (=6)
		for (int i = 0; i < limit; i++) {
			System.out.print((char) buffer.get());
		}
	}
}
